package nc.bs.pub.action;

import nc.bs.common.projectFAUtils;
import nc.bs.framework.common.NCLocator;
import nc.bs.pub.compiler.AbstractCompiler2;
import nc.itf.pu.m25.IInvoiceApprove;
import nc.vo.pu.m25.entity.InvoiceVO;
import nc.vo.pub.BusinessException;
import nc.vo.pub.compiler.PfParameterVO;
import nc.vo.pubapp.pub.power.PowerActionEnum;
import nc.vo.scmpub.res.billtype.POBillType;
import nc.vo.uap.pf.PFBusinessException;
import nccloud.vo.scmpub.utils.power.DataPermissionUtil;

public class N_25_SAVE extends AbstractCompiler2 {
	public Object runComClass(PfParameterVO paraVo) throws BusinessException {
		try {
			super.m_tmpVo = paraVo;
			InvoiceVO[] retValue = null;
			InvoiceVO[] vos = (InvoiceVO[]) ((InvoiceVO[]) this.getVos());
			if (paraVo.isCloudEntry) {
				DataPermissionUtil.checkPermission(vos, POBillType.Invoice.getCode(),
						PowerActionEnum.COMMIT.getActioncode(), "vbillcode");
			}

			//lhw 231128 保存前校验项目 begin
			new projectFAUtils().projectDataApprove("po_invoice", vos, "commit");
			//end
			
			retValue = ((IInvoiceApprove) NCLocator.getInstance().lookup(IInvoiceApprove.class)).sendapprove(vos, this);
			return retValue;
		} catch (Exception var4) {
			if (var4 instanceof BusinessException) {
				throw (BusinessException) var4;
			} else {
				throw new PFBusinessException(var4.getMessage(), var4);
			}
		}
	}
}